<header class="show-header">
  <h2 class="visually_hidden"><%= @podcast.name %></h2>
  <div class="show-header-inner">

    <div class="show-header-art">
      <img
        src="<%= cover_url(@podcast, :original) %>"
        srcset="<%= cover_url(@podcast, :original) %> 3000w, <%= cover_url(@podcast, :medium) %> 440w"
        sizes="(min-width:880px) 490w, 440w"
        alt="<%= @podcast.name %> Artwork"
      >
    <%= if @podcast.status != :publishing do %>
      <div class="show-header-art-status show-header-art-status--<%= @podcast.status %>"><span><%= status_text(@podcast) %></span></div>
    <% end %>
    </div>

    <div class="show-header-content">
    <%= if Podcast.is_active(@podcast) do %>
      <%= if is_map(@trailer) do %>
        <%= link("Listen to the Trailer",
            title: "Play the Trailer",
            to: EpisodeView.audio_url(@trailer),
            role: "button",
            data: [play: ~p"/#{@podcast.slug}/#{@trailer.slug}/play"],
            class: "show-header-play_trailer button_play") %>
      <% else %>
        <% latest = List.first(@page.entries) %>
        <%= if is_map(latest) do %>
          <%= link("Listen to the latest",
              to: EpisodeView.audio_url(latest),
              role: "button",
              data: [play: ~p"/#{@podcast.slug}/#{latest.slug}/play"],
              class: "show-header-play_trailer button_play") %>
        <% end %>
      <% end %>
    <% end %>

      <div class="show-header-description">
        <h3><%= (@podcast.welcome || @podcast.description) |> PublicHelpers.no_widowed_words() |> raw() %></h3>
        <%= @podcast.schedule_note |> SharedHelpers.md_to_html() |> raw() %>
      </div>

      <%= if Enum.any?(@podcast.active_hosts) do %>
      <div class="show-header-hosts avatar_list <%= if length(@podcast.active_hosts) < 4, do: 'avatar_list--full' %>">
      <%= for person <- @podcast.active_hosts do %>
        <%= link to: PersonView.profile_path(person), class: "avatar_list-item", title: person.name do %>
          <%= SharedHelpers.lazy_image(PersonView.avatar_url(person), "Host Avatar", width: 60, height: 60) %>
          <%= if length(@podcast.active_hosts) < 4 do %>
            <p><%= person.name %></p>
          <% else %>
            <p><%= PersonView.first_name(person) %></p>
          <% end %>
        <% end %>
      <% end %>
      </div>
      <% end %>

      <hr class="show-header-break">

      <%= cond do %>
      <% @podcast.status == :inactive -> %>
        <p class="show-header-signup_text">This podcast is not currently in production. <%= link("Head here", to: Routes.podcast_path(@conn, :index)) %> for more awesome podcasts.</p>
      <% !Podcast.has_feed(@podcast) -> %>
        <p>You can only subscribe to <em><%= @podcast.name %></em> by subscribing to our <%= link("Master Feed", to: Routes.podcast_path(@conn, :show, "master")) %></p>
      <% Podcast.is_a_changelog_pod(@podcast) -> %>
        <%= render("_news_subscribe.html", assigns) %>
        <%= render("_subscribe_buttons.html", assigns) %>
      <% true -> %>
        <%= render("_podcast_subscribe.html", assigns) %>
        <%= render("_subscribe_buttons.html", assigns) %>
      <% end %>
    </div>

  </div>
</header>
